This function returns a binding of class, instrument and section. same-as is context sensitive and allows you to omit the instrument and section when using it withing def-class, clone-class or clone-section-class.
If you don't want to refer to the currently processed class, instrument and section, you may supply the full parameters. The output is normally exactly the same as the original binding made for that entity, but you may change it with :collapse keyword.
(def-class symbol bass
sect-a '(nil (c d) (e f))
)
(same-as symbol of bass in sect-a)
--> (nil (c d) (e f))
:collapse flattens the list and removes nils.
(same-as symbol of bass in sect-a :collapse)
--> (c d e f)
Collapsed binding is useful if you want to process the elements distributed over the section, and then use skip-zone or distribute to redistribute the material over zones of a section. The difference in processing zoned list as (nil (c d) (e f)) or a collapsed list (c d e f) appears in many situations.
(do-section :all '(symbol-retrograde x)
(same-as symbol of bass in a))
--> (nil (d c) (f e))
(symbol-retrograde (same-as symbol of bass in a :collapse))
--> (f e d c)
The first one is retrograded within zones, but the second is retrograded as a whole. If the the retrograded pattern is to be distributed over the zones, then the resulting zones will be very different s compared to the first example.
same-as asscepts the following different calls:
(same-as intro)
(same-as intro :collapse)
(same-as symbol of bass)
(same-as symbol of bass :collapse)
(same-as symbol of bass in intro)
(same-as symbol of bass in intro :collapse)
Notice that when you supply same-as one argument, it can only be a section. For example, (same-as symbol) or (same-as zone) don't work.